<?php
namespace App\Lib\Library;
use Hyperf\DbConnection\Db;
use Closure;
trait UseZyLib
{
    public function transactionDb(Closure $callback)
    {
        Db::beginTransaction();
        try {
            $value = $callback();
            Db::commit();
        } catch (\Throwable $ex) {
            Db::rollBack();
        }
        return  $value;
    }
}